package cn.uniquetech;

import java.util.Map;
import java.util.TreeMap;

public class TE {

	/**
	 * @param args
	 */

	private String paySign(String prepay_id, String timestamp, String nonce_str) {
		TreeMap<String, String> treeMap = new TreeMap<String, String>();
		treeMap.put("appId", "appId");
		// treeMap.put("mch_id", mchId);
		treeMap.put("timeStamp", timestamp);
		treeMap.put("nonceStr", nonce_str);
		treeMap.put("signType", "MD5");
		treeMap.put("package", "prepay_id=" + prepay_id);
		return getSign(treeMap, "partnerKey");
	}

	private String getSign(Map<String, String> params, String paternerKey) {
		StringBuilder sb = new StringBuilder();
		for (String key : params.keySet()) {
			sb.append(key).append("=").append(params.get(key)).append("&");
		}
		sb.append("key=" + paternerKey);
		String str = sb.toString().substring(0, sb.toString().length() - 1);
		// String signValue = MD5Util.MD5Encode(sb.toString(),
		// "utf-8").toUpperCase();
		return str;
	}
//Parameters: 44(Integer), admin(String), 127.0.0.1(String), 2017-04-14 09:58:48.837(Timestamp), 0(Integer), mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like gecko) chrome/45.0.2454.101 safari/537.36(String), C93FDF4DBC2F4978963F2F832E7A5678(String)
	//2017-04-14 09:58:48 -550910 [http-apr-8080-exec-4] DEBUG   - 
	public static void main(String[] args) {
		// 752
		// String xml =
		// "<xml><appid><![CDATA[wxecaef476b344251f]]></appid><bank_type><![CDATA[CFT]]></bank_type><cash_fee><![CDATA[1]]></cash_fee><fee_type><![CDATA[CNY]]></fee_type><is_subscribe><![CDATA[Y]]></is_subscribe><mch_id><![CDATA[1378896402]]></mch_id><nonce_str><![CDATA[E5F6AD6CE374177EEF023BF5D0C018B6]]></nonce_str><openid><![CDATA[ocapiwXbShVlRBtiPHYALDLEHiHQ]]></openid><out_trade_no><![CDATA[uqxwzf1]]></out_trade_no><result_code><![CDATA[SUCCESS]]></result_code><return_code><![CDATA[SUCCESS]]></return_code><sign><![CDATA[7C20D3FE953DCBD60FD5A7AD2B81D661]]></sign><time_end><![CDATA[20160908100110]]></time_end><total_fee>1</total_fee><trade_type><![CDATA[JSAPI]]></trade_type><transaction_id><![CDATA[4005442001201609083397507998]]></transaction_id></xml>";
		// xml = xml.replaceAll("<![CDATA[", "");
		// System.out.println(xml.length());
		String str = "C93FDF4DBC2F4978963F2F832E7A5678";
		System.out.println(str.length());
	}

}
